package com.itnetwork.Action;

import java.io.ByteArrayInputStream;
import java.util.List;

import javax.annotation.Resource;

import net.sf.json.JSONArray;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.itnetwork.ServiceImp.CategoryServiceImp;
import com.opensymphony.xwork2.ActionSupport;
@Component("categoryAction")
@Scope("prototype")
public class CategoryAction extends ActionSupport{
//		private List<Category> categoryList=new ArrayList<Category>();
		//private List<Object[]> comboboxModel;
		private String comboboxModelSt;
		private int cid;
		private CategoryServiceImp categoryServiceImp;
		//private ByteArrayInputStream is;

		public String CategoryList(){
			System.out.println("start..");
			List<Object[]> comboboxModel=categoryServiceImp.getComboboxModel();
			System.out.println(comboboxModel);
			JSONArray jsonArray = JSONArray.fromObject(comboboxModel);
			comboboxModelSt=jsonArray.toString().replaceAll("\"", "'");
			System.out.println(comboboxModelSt);
			//is=new ByteArrayInputStream(comboboxModelSt.getBytes());
			return this.SUCCESS;
		}
		
	/*	public List<Object[]> getComboboxModel() {
			return comboboxModel;
		}

		public void setComboboxModel(List<Object[]> comboboxModel) {
			this.comboboxModel = comboboxModel;
		}*/

	/*	public ByteArrayInputStream getIs() {
			return is;
		}

		public void setIs(ByteArrayInputStream is) {
			this.is = is;
		}*/

		public String getComboboxModelSt() {
			return comboboxModelSt;
		}

		public void setComboboxModelSt(String comboboxModelSt) {
			this.comboboxModelSt = comboboxModelSt;
		}

		public CategoryServiceImp getCategoryServiceImp() {
			return categoryServiceImp;
		}
	


		public int getCid() {
			return cid;
		}

		public void setCid(int cid) {
			this.cid = cid;
		}

		@Resource(name="categoryServiceImp")
		public void setCategoryServiceImp(CategoryServiceImp categoryServiceImp) {
			this.categoryServiceImp = categoryServiceImp;
		}

}
